package com.punai.standard.controller;

import com.punai.common.annotation.Log;
import com.punai.common.core.controller.BaseController;
import com.punai.common.core.domain.AjaxResult;
import com.punai.common.core.page.TableDataInfo;
import com.punai.common.enums.BusinessType;
import com.punai.standard.domain.StaGxLinkGk;
import com.punai.standard.service.IStaGxLinkGkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 标准费用项关联归口Controller
 * 
 * @author zhx
 * @date 2023-06-26
 */
@RestController
@RequestMapping("/sta/staGxLinkGk")
public class StaGxLinkGkController extends BaseController
{
    @Autowired
    private IStaGxLinkGkService staGxLinkGkService;

    /**
     * 查询标准费用项关联归口列表
     */
    @PreAuthorize("@ss.hasPermi('sta:staGxLinkGk:list')")
    @GetMapping("/list")
    public TableDataInfo list(StaGxLinkGk staGxLinkGk)
    {
        startPage();
        List<StaGxLinkGk> list = staGxLinkGkService.selectStaGxLinkGkList(staGxLinkGk);
        return getDataTable(list);
    }

    /**
     * 获取标准费用项关联归口详细信息
     */
    @PreAuthorize("@ss.hasPermi('sta:staGxLinkGk:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(staGxLinkGkService.selectStaGxLinkGkById(id));
    }

    /**
     * 新增标准费用项关联归口
     */
    @PreAuthorize("@ss.hasPermi('sta:staGxLinkGk:add')")
    @Log(title = "标准费用项关联归口", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody StaGxLinkGk staGxLinkGk)
    {
        return toAjax(staGxLinkGkService.insertStaGxLinkGk(staGxLinkGk));
    }

    /**
     * 修改标准费用项关联归口
     */
    @PreAuthorize("@ss.hasPermi('sta:staGxLinkGk:edit')")
    @Log(title = "标准费用项关联归口", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody StaGxLinkGk staGxLinkGk)
    {
        return toAjax(staGxLinkGkService.updateStaGxLinkGk(staGxLinkGk));
    }
}
